;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Ave Cruce Salus Mea ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; program: Win3ds31 - *.3ds / *.asc files viewer + demonstration of ;; several graphics effects + tiny based on Bezier curves and ;; patches 3d objects editor + some manipulation on 3d mesh ;; routines. ;; author: Maciej Guba aka macgub ;; web : http://macgub.co.pl - if this site not works, search the web ;; for keyword 'macgub'. ;; email : macgub3@wp.pl ;; This application don't uses any particular 3d graphic library. ;; Written from scratch in pure assembler. Thanks to all, who was ;; helping me to do it. Especially: ;; Jan Pawel II, Tomasz Grysztar, Madis Kalme, Mikolaj Feliks, Lostcauz, ;; Brian Paul, Reverend, Pablo Reda, MHajduk, Ica, James Foley, ;; Andries van Dam, Steven Feiner, John Hughes, Richard Phillips, ;; tthsqe, J. Burkardt, Morgan McGuire, Pierre Bezier, Przemyslaw Kiciak ;; and many others... ;; ;; Program needs SSE3 extension. ;; ;; Coding style is terribly ugly. Other words it's my own mess. ;) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Keys / GUI Buttons description (under left mouse button click) : ;; SPACE key / 'dr. model' button - switching beetwen displaying ;; models: flat, smooth shading, spherical environment, ;; texture, bump, smooth + texture, two texture and bump ;; + texture mapping pararell, edges only (smooth shaded, ;; textured lines), flat with float single precision Z ;; coordinate, point light with shadow light position ;; dependent, real Phongs shading with float normal vector ;; interpolation... Description of actual displaying model ;; on bar located at top of app window; ;; ;; TAB / 'ran. light' - generate three unlinear directional ;; lights (Phongs illumination); ;; ;; F1 / 'mot. blur' - motion blur on/off; ;; ;; F2 / 'cur object' - cyclic switching between objects (from ;; file and predefined: heart (Sanctissimi Cordis Christi) ;; and tetrahedron). ;; F3/F4(+/-) keys / 'zoom in/out' buttons - no comment; ;; ;; F5 / 'tex. mapp.' button - choose bumps also texture mapping ;; planar or spherical (planar according to axis X, Y, Z); ;; ;; F6 / 'bumps' - switching between random bumps and texture ;; dependent; ;; ;; F7 / 'texture' - select texture: red white stripes, xored face ;; also blank (witch can by used in smoothing objects edges). ;; App also allows load texture from external file (X key); ;; ;; F8 / 'save obj.' - save 3d currently shown object to file ;; "object.asc" and "object.3ds" in current folder; ;; ;; F9 / 'Culling' - backface culling on/off; ;; ;; F11 / 'run/stop' button - main rotary on/off; ;; ;; F12 / 'rotary' - main rotary cyclic switching - around axis ;; X, Y, Z and custom - use mouse and hold it's left button; ;; ;; ;; D / 'do displ.' - do displacement mapping texture dependent; ;; ;; T / 'do triang.' - triangulize objects faces from teslation ;; area; it's mean divide each face inside area to four ;; smaller faces; ;; ;; ;; U / 'rand. shd.' button - random point (spot) light position ;; and obliquity of plane on wihch shadow falls; ;; ;; V / 'edit mesh.' button - edit option, posibility to edit ;; according to vertex, single face or edge. Use left mouse ;; button and yellow handlers; ;; ;; W / 'set t. area' button - set teslate area - default ;; is whole screen; ;; ;; C / 'set t. col' - set color that will by bypassed when ;; teslation occured, options - black, white; ;; ;; F / 'dsp. factor' - set diplacement factor, determine bumps ;; that make displacement higher or lower; ;; ;; B / 'bezier sr.' button - select predefined object, assembled ;; using bezier patches; ;; ;; A / 'set ap tol' button - set approximation tolerance of adding ;; near bezier vertices, some of them are redundant (on tangent ;; of bezier patches), this value is used also in removing ;; redundand (or just merge) vertices option, use 'Rm red ver' ;; button to execute this operation; ;; ;; E / 'b. derives' button - draw Bezier derives, selected by B ;; key; posiblity to edit Bezier patches by stopping animation ;; (button run/stop) and move yellow bars with pressed left ;; mouse button, when left button is released new position of ;; bar and is accepted. Bezier patches are recalculated permanently. ;; To achive previous geometry restart app; ;; ;; 't&d wh|pos' button - displacement options if set on ;; 'posi' - only positive z cooficient vertices are affected, ;; if set on 'whol' all vertices of displacement process are ;; affected; ;; ;; S / 'speed' button - toggle speed; ;; ;; 'Rm unu ver' button - remove unused vertices, other words remove ;; this vertices that are unused in triangles list; ;; ;; P / 'Long pipe ' button - make long multi segment pipe, editing ;; pipe - hold left mouse button on yellow bar - moving node, ;; hold right mouse button and move them - rotate pipe project, ;; pressing once again 'Long pipe ' menu button - render pipe; ;; ;; 'Lp segs cn' menu button - determine long pipe segments count; ;; ;; 'Lp Bez/Bsp' button - determine curve type long pipe based, ;; options - Bezier / Bspline ;; ;; ;; 'Lp quality' - determine long pipe quality (triangles count ;; per segment); ;; ;; 'NextM edit' menu button - edit next (earliest loaded joined) ;; mesh and: blue bar determines X,Y position, violet bar ;; determines Z position, yellow bar determies scale of new ;; loaded freshly new part of mesh, move bars with mouse and ;; its left button, in violet and yellow bars cause only vertiical ;; move is allowed. Red bar position rotate new part of mesh; ;; ;; 'Rm red ver' button - removing redundand vertices, according ;; to aproximation tolerancy value (use 'set ap tol' button to ;; set this value); ;; ;; 'Draw norm.' button - drawing faces and vertices normal vectors; ;; ;; 'Z rdu care' button - take care about Z cooficient of vertex ;; during remove redundand vertices operation - 'Rm red ver' ;; button. ;; ;; 'Rm ins fac' button - try to remove inside faces - that are ;; covered by other faces outside mesh; ;; ;; 'Ma Coll Ed' button - mark and count collided edges. It means ;; edges that intersect other triangles; ;; ;; 'Srch Chunk' button - search for seprate manifold chunks. Marks ;; edge of triangles that are adjacent one to another. It mean form ;; one of such triangle is possible "go" to other triangle across its ;; vertices to other triangle from separate chunk. Chunks are counted; ;; ;; 'Sm ins edg' button - smooth inside edges. It is simplification ;; mesh option. After removing inside faces (which is also simplifi- ;; cation option), inside edges of adjacent triangles that are ;; removed, are usually jagged. This option try to fix such situation. ;; Some small margin are leaved. Option require to be sense of normal ;; vectors well declared; ;; ;; 'Clip faces' - clip faces that are in triangulation(teslate) area ;; such area can be set using 'set t. area' button; ;; ;; 'Invert chn' button - invert sense of normal vectors in one ;; separate chunk, first the 'Srch Chunk' button should be set "on", ;; then pause animation using 'run/stop' button, move mouse cursot on ;; unique triangle mark (bar with unique color, in center of triangle, ;; separate to each chunk) and click with left mouse button. Senses of ;; normal vectors in whole chunk will be reversed; ;; ;; 'Crop front' button - crop front faces, some small margin (a few ;; degrees on each direction) is leaved; ;; ;; 'Del. chunk' button - delete separate chunk, first the 'Srch Chunk' ;; button should be set "on", then pause animation using 'run/stop' ;; button, move mouse cursot on unique triangle mark (bar with unique ;; color, in center of triangle, separate to each chunk) and click ;; with left mouse button. Selected chunk will be deleted. When flag ;; of this button will be set on 'calc'- edges, faces and vertices ;; number will be recalculated; ;; ;; 'Ray shadows' button - calculate ray casted shadows of mesh; ;; ;; 'Tes TIV IE' button - teslate(triangulize) triangles with at last ;; one inside vertex and at at last one edge that intersect. First ;; 'Ma Coll Ed' -> mark collided edges and 'Mark in vr' -> mark ;; inner vertices buttons must be set "on"; ;; ;; 'Mark in vr' button - searching for inside vertices option. ;; Vertices are counted. This value is displayed below menu on the ;; right. Calculations mat take some time - its done using many ;; palarell projections; ;; ;; 'Rm TIV NIE' button - remove triangles with at last one inside ;; vertex and wihout any intersected edge. First 'Ma Coll Ed' -> ;; -> mark collided edges and 'Mark in vr' -> mark inside vertices ;; buttons must be set "on"; ;; ;; 'Rm dead tr' button - some triangles have duplicated, or even ;; tripled index of triangle - so it geometric representation is ;; line, or point - remove such triangles to save memory space; ;; ;; 'Rm cracks' button - remove cracks. After teslation of chosen ;; area of object (not whole} may take place such unneeded artifact: ;; Along edge may occur an vertex thats only touch edge but is not ;; possesed by this edge. Routine adjacent to this button cure this ;; situation. Only vertces thats are in the middle of edge ;; are computed; ;; ;; 'Show chunk' - show manifold chunks bars, color is individual for ;; each chunk. Chunks may be found by 'Srch Chunk' button (work not ;; OK in all cases), also is calculated when freshly mesh file is loaded; ;; ;; X key - load texture (raw format 512X512 pixels 24bit 0xRRGGBB); ;; ;; N key - load new mesh (old will be abandoned); ;; ;; M key - load new mesh and join it to the old, (Posibility to edit ;; position of fresh load mesh using 'NextM edit' button. ;; See description of this button for details; ;; ;; ;; ESC key - exit. ;; ;; Right mouse pressed button and move - setting position of texture, ;; (works in all drawing models, but is visable only in ;; texture displaying models). ;; ;; General note about implemented operations. - Some of it may run teribly ;; slow aspecially on 'big' objects. Maybye some tests for low detail objects ;; may prevent your speed disapointing. Note that even operations on small ;; objects may be slow, bacause way of sloving problem - a few ops use multi ;; (~4000) parallel projections of object during process. ;; Its 32 bit app, so object above ~10 000 000 vertices/faces may be to big ;; for 4GB RAM limit - some operations alloc temporaly many memory (because ;; usig mem greedy pivot lists). ;; ;; ;; After run program shows dialog to open file. ;; Choose file in 3ds or asc format and ...admire. ;) ;; ;; ;; ;; "No work is ever complete, ;; and this one is no exception." ;; Pierre Bezier ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;